package Buffer;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class BufferStreamDemo {
    public static void main(String[] args) throws IOException {
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("funCode\\bos.txt"));

        bos.write("heel \r\n".getBytes(StandardCharsets.UTF_8));
        bos.close();

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("funCode\\bos.txt"));

        // 读数据 一次读取一个字节数据
        byte[] bytes = new byte[1024];
        int len;
        while ((len = bis.read(bytes))!=-1) {
            System.out.println(new String(bytes,0,len));
        }

        bis.close();
    }
}
